<template>
  <el-config-provider :locale="locale">
    <router-view />
  </el-config-provider>
</template>

<script setup lang="ts">
  import en from 'element-plus/lib/locale/lang/en'
  import zhCn from 'element-plus/lib/locale/lang/zh-cn'
  import { computed } from 'vue';
  import store from './store';
  /**
   * import.meta.glob暂时不支持node_modules导入
   * const modules = import.meta.glob('/node_modules/element-plus/lib/locale/lang/*.js')
   * console.log(modules)
   * https://github1s.com/vitejs/vite/blob/HEAD/packages/vite/src/node/importGlob.ts#L64
   * https://github.com/vitejs/vite/issues/5728
   */
  const language = store.state.app.language
  const locale = computed(() => {
    switch (language) {
      case 'en':
        return en
      case 'zh-cn':
        return zhCn
    }
  })
 
</script>
